<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>评价</title>
    <!--公用样式-->
    <link rel="stylesheet" type="text/css" href="${re.contextPath}/plugin/common/css/comment.css"/>
    <!--页面样式-->
    <link rel="stylesheet" type="text/css" href="${re.contextPath}/plugin/common/css/style.css"/>
    <!--Layui-->
    <link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css" media="all"/>
<#--    <link rel="stylesheet" type="text/css" href="${re.contextPath}/plugin/common/css/layui.css"/>-->
    <!--页面样式-->
    <link rel="stylesheet" type="text/css" href="${re.contextPath}/plugin/common/css/extended.css"/>
    <!--JQ-->
    <script type="text/javascript" charset="utf-8"
            src="${re.contextPath}/plugin/common/js/jquery-1.8.3.min.js"></script>
    <!--Layui-->
    <script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.all.js" charset="utf-8"></script>
    <!--公用样式JS-->
    <script type="text/javascript" charset="utf-8" src="${re.contextPath}/plugin/common/js/comment.js"></script>
    <!--进度条-->
    <style>
        .layui-table-view .layui-table {
            width: 100%;
        }
    </style>
</head>

<body style="background-color: #fff;height:100%">

<!--容器-->
<div style="padding: 40px;">
    <h2>${spName}</h2>
        <table id="envresult" lay-filter="envresult" style="width:100%"></table>
</div>
<div class="layui-row pb15">
    <div style="text-align: center">
        <input type="button" onclick="clos()" class="layui-btn layui-btn-normal" value="关闭">
    </div>
</div>
<script>
    $(function () {
        var spId = '${spId}';
        layui.use(['layer','table'], function () {
            table = layui.table,$=layui.$;
            //评分结果表格：
            table.render({
                elem: '#envresult'
                ,url: '/jc/projectManager/tagResultList?spId='+spId //数据接口
                ,height:'full-190'
                ,page: false //开启分页
                , cols:  [
                    [
                        {field: 'bdBadtName', title: '', width: '24%', align: 'left',rowspan: 2},
                        {field: 'one', title: '很满意', width: '15%', align: 'center'},
                        {field: 'two', title: '满意', width: '15%', align: 'center'},
                        {field: 'three', title: '基本满意', width: '15%', align: 'center'},
                        {field: 'four', title: '不满意', width: '15%', align: 'center'},
                        {field: 'avgScore', title: '平均分', width: '16%', align: 'center',rowspan: 2,templet: function(d){
                            return '<span class="avgscore">'+d.avgScore+'</span>'
                            }}
                    ],
                    [
                        {title: '90-100', width: '15%', align: 'center'},
                        {title: '80-89', width: '15%', align: 'center'},
                        {title: '60-79', width: '15%', align: 'center'},
                        {title: '0-59', width: '15%', align: 'center'},
                        // {title: '备注', width: '18%', align: 'center'}
                    ]
                  ],
                done: function(res,curr,count){
                    //去掉因为双表头出现的多余的列
                    $(".layui-table-body").find("td").each(function(index,element){
                        if( $(this).attr('data-field')*1 > 5){
                            // $(this).css("display","none");
                            $(this).remove();
                        }
                    })
                    // //最后一行合并单元格
                    $(".layui-table-body").find("tr:last").each(function(index,element){
                        $.each($(this).find('td'),function(e,o){
                            if(e == 0){
                                $(o).attr('colspan','5');
                                $(o).attr('align','center')
                            }
                            if(e == 1){
                                $(o).attr('id','total')
                                totalAvgObj = $(o);
                            }
                            if(e > 1){
                                $(o).remove();
                            }
                        })
                    });
                    //左上角的图片:
                    var firstTh = $('th[data-field="bdBadtName"]');
                    console.log(firstTh);
                    firstTh.css("padding","0px");
                    firstTh.find('div').css("padding","0px");
                    firstTh.find('div').css("height","100%");
                    firstTh.find('div').html('<img src="${re.contextPath}/plugin/common/images/hd.png" style="max-width:none !important;width:100%;height:100%">')
                }
            });
        });
    });
    function clos(){
        var index =parent.layer.getFrameIndex(window.name);
        parent.layer.close(index);
    }
</script>

</body>
</html>